home *** CD-ROM | disk | FTP | other *** search
/ AppleScript - The Beta Release / AppleScript - The Beta Release.iso / Documentation / develop / Better Apple Event Coding / Code Samples / TECommon.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-16  |  6.2 KB  |  184 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------------------
  2.  
  3.     Program:    CPlusTESample 2.0AE
  4.     File:        TECommon.h
  5.  
  6.     by Andrew Shebanow
  7.     of Apple Macintosh Developer Technical Support
  8.     with modifications by Eric Berdahl
  9.  
  10.     Copyright © 1989-1990 Apple Computer, Inc.
  11.     Copyright © 1992 Eric Berdahl
  12.     All rights reserved.
  13.  
  14. ------------------------------------------------------------------------------------------*/
  15.  
  16. #ifndef __TECOMMON__
  17. #define __TECOMMON__
  18.  
  19. /*
  20.     These definitions are shared by Rez and C++. We use #define statements
  21.     instead of constants in this file because Rez doesn't support constants,
  22.     and since the 3.0b1 version of Rez doesn't like the C++ comments, we use
  23.     C style comments in this file as well.
  24.  */
  25.  
  26. /*    Determining an application's minimum size to request from MultiFinder depends
  27.     on many things, each of which can be unique to an application's function,
  28.     the anticipated environment, the developer's attitude of what constitutes
  29.     reasonable functionality and performance, etc. Here is a list of some things to
  30.     consider when determining the minimum size (and preferred size) for your
  31.     application. The list is pretty much in order of importance, but by no means
  32.     complete.
  33.  
  34.     1.    What is the minimum size needed to give almost 100 percent assurance
  35.         that the application won't crash because it ran out of memory? This
  36.         includes not only things that you do have direct control over such as
  37.         checking for NIL handles and pointers, but also things that some
  38.         feel are not so much under their control such as QuickDraw and the
  39.         Segment Loader.
  40.  
  41.     2.    What kind of performance can a user expect from the application when
  42.         it is running in the minimum memory configuration? Performance includes
  43.         not only speed in handling data, but also things like how many documents
  44.         can be opened, etc.
  45.  
  46.     3.    What are the typical sizes of scraps that a user might wish to work
  47.         with when lauching or switching to your application? If the amount
  48.         of memory is too small, the scrap will be purged from memory. This
  49.         can be quite frustrating to the user.
  50.  
  51.     4.    The previous items have concentrated on topics that tend to cause an
  52.         increase in the minimum size to request from MultiFinder. On the flip
  53.         side, however, should be the consideration of what environments the
  54.         application may be running in. There may be a high probability that
  55.         many users with relatively small memory configurations will want to
  56.         avail themselves of your application. Or, many users might want to use it
  57.         while several other, possibly related/complementary applications are
  58.         running. If that is the case, it would be helpful to have a fairly
  59.         small minimum size.
  60.  
  61.     What we did for TESample:
  62.  
  63.         We determined the smallest heap size that TESample could have and
  64.         still run (24K). For the preferred size we added enough space to permit:
  65.             a. a maximum size TextEdit text handle for each window (4x32000 characters)
  66.             b. a maximum usable TextEdit scrap (32000 characters)
  67.             b. a maximum scrap as a result of Copy (32000 characters)
  68.             d. a little performance cushion (see 2, above) (10K)
  69.         Result: 220K for preferred size
  70.  
  71.         For the minimum size we took the 24K and then scaled down our requirements
  72.         for a,b, and c above. We thought that providing 76 more would be "lean
  73.         and mean" for a multiwindow program (see 4, above).
  74.         Result: 96K for minimum size
  75. */
  76.  
  77. #define kPrefSize                220
  78. #define kMinSize                96
  79.  
  80. /* kMinHeap - This is the minimum result from the following
  81.      equation:
  82.  
  83.             ORD(GetApplLimit) - ORD(ApplicZone)
  84.  
  85.      for the application to run. It will insure that enough memory will
  86.      be around for reasonable-sized scraps, FKEYs, etc. to exist with the
  87.      application, and still give the application some 'breathing room'.
  88.      To derive this number, we ran under a MultiFinder partition that was
  89.      our requested minimum size, as given in the 'SIZE' resource. */
  90.  
  91. #define    kMinHeap                 (90 * 1024)
  92.  
  93. /* kMinSpace - This is the minimum result from PurgeSpace, when called
  94.      at initialization time, for the application to run. This number acts
  95.      as a double-check to insure that there really is enough memory for the
  96.      application to run, including what has been taken up already by
  97.      pre-loaded resources, the scrap, code, and other sundry memory blocks. */
  98.  
  99. #define    kMinSpace                (64 * 1024)
  100.  
  101. /* id of our STR# for error strings */
  102. #define kTEDocErrStrings     1024
  103.  
  104. /* The following are indicies into STR# resources. */
  105. #define    eNoMemory                1
  106. #define    eNoSpaceCut                2
  107. #define    eNoCut                    3
  108. #define    eNoCopy                    4
  109. #define    eExceedPaste            5
  110. #define    eNoSpacePaste            6
  111. #define    eNoWindow                7
  112. #define    eExceedChar                8
  113. #define    eNoPaste                9
  114. #define eBadFileType            10
  115.  
  116. #define    rMenuBar    1024            /* application's menu bar */
  117. #define    rAboutAlert    1024            /* about alert */
  118. #define    rDocWindow    1024            /* application's window */
  119. #define    rVScroll    1024            /* vertical scrollbar control */
  120. #define    rHScroll    1025            /* horizontal scrollbar control */
  121.  
  122. /* The following constants are used to identify menus and their items. The menu IDs
  123.    have an "m" prefix and the item numbers within each menu have an "i" prefix. */
  124. #define    mApple                    1024    /* Apple menu */
  125. #define    iAbout                    1
  126.  
  127. #define    mFile                    1025    /* File menu */
  128. #define    iNew                    1
  129. #define iOpen                    2
  130. #define    iClose                    4
  131. #define iSave                    5
  132. #define iSaveAs                    6
  133. #define iRevert                    7
  134. #define iPageSetup                9
  135. #define iPrint                    10
  136. #define    iQuit                    12
  137.  
  138. #define    mEdit                    1026    /* Edit menu */
  139. #define    iUndo                    1
  140. #define    iCut                    3
  141. #define    iCopy                    4
  142. #define    iPaste                    5
  143. #define    iClear                    6
  144. #define    iSelectAll                8
  145.  
  146. #define    mFont                    1027    /* Font menu */
  147.  
  148. #define    mFontSize                1028    /* Font size menu */
  149. #define    i9Point                    1
  150. #define    i10Point                2
  151. #define    i12Point                3
  152. #define    i14Point                4
  153. #define    i18Point                5
  154. #define    i24Point                6
  155.  
  156. #define    mStyle                    1029    /* Style menu */
  157. #define    iPlain                    1
  158. #define    iBold                    3
  159. #define    iItalic                    4
  160. #define    iUnderline                5
  161. #define    iOutline                6
  162. #define    iShadow                    7
  163.  
  164. #define    cFinderNew                1
  165. #define    cFinderOpen                2
  166. #define    cFinderPrint            3
  167. #define    cFinderQuit                4
  168. #define    cClose                    5
  169. #define    cSave                    6
  170. #define    cNewElement                7
  171. #define    cGetData                8
  172. #define    cSetData                9
  173.  
  174.  
  175. #define    pPosition                'ppos'
  176. #define pText                    'TEXT'
  177.  
  178. #define    typeText                'TEXT'
  179.  
  180. #define    keyAETheData            'kdat'
  181. #define    keyAEObjToCreate        'obtc'
  182.  
  183. #endif
  184.